package com.epfresh.views.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.epfresh.R;
import com.epfresh.api.universalimageloader.core.ImageLoader;
import com.epfresh.api.utils.T;
import com.epfresh.api.utils.VerificationUtils;
import com.epfresh.bean.GoodsDetail;

import java.util.List;

/**
 * Created by wzh on 16-7-13.
 */
public class OrderFailDialog extends BaseDialogView implements View.OnClickListener {


    View.OnClickListener onBackCartClickListener;

    TextView tvContent;
    TextView tvBtn;

    public View.OnClickListener getOnBackCartClickListener() {
        return onBackCartClickListener;
    }

    public void setOnBackCartClickListener(View.OnClickListener onBackCartClickListener) {
        this.onBackCartClickListener = onBackCartClickListener;
    }

    public OrderFailDialog(Context context) {
        super(context);

        init();
    }

    public void show(String content,String btnStr) {
        super.show();
        tvContent.setText(content);
        tvBtn.setText(btnStr);
    }

    @Override
    public void initBefore() {
        setGravity(Gravity.CENTER);
    }

    @Override
    protected void initAnim() {
        super.initAnim();
        inAnim1 = new AlphaAnimation(0.0f, 1.0f);
        inAnim1.setDuration(500);
        outAnim1 = new AlphaAnimation(1.0f, 0.0f);
        outAnim1.setDuration(500);
    }

    private void init() {

        View v = LayoutInflater.from(context).inflate(R.layout.dialog_order_fail, contentContainer);

        tvBtn = (TextView) v.findViewById(R.id.tv_btn_cart);
        tvBtn.setOnClickListener(this);

        tvContent = (TextView) v.findViewById(R.id.tv_exception_title);
        setCancelable(true);

    }

    public void show(String title) {
        tvContent.setText(title);
        super.show();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_btn_cart:

                if (onBackCartClickListener != null){
                    onBackCartClickListener.onClick(view);
                }
                break;


        }
    }

}
